import React, { lazy } from "react";

const Login = lazy(() => import("../page/Login/index"));

const Livedacte = lazy(() => import("../page/Livedacte/index"));
const Housingdacte = lazy(() => import("../page/Housingdacte/index"));

const Register = lazy(() => import('../page/Register/index'))
const Home = lazy(() => import("../page/Home/index"));
const Housing = lazy(() => import("../page/Home/Housing/index"));
const Live = lazy(() => import("../page/Home/Live/index"));
const Group = lazy(() => import("../page/Home/Group/index"));
const Audit = lazy(() => import("../page/Home/Audit/index"));
const Order = lazy(() => import("../page/Home/Order/index"));
const Consult = lazy(() => import("../page/Home/Consult/index"));
const Broker = lazy(() => import("../page/Home/Broker/index"));


const HousingAdd = lazy(() => import("../page/HousingAdd/index"))

export const MenuList = [
  {
    path: "/home/housing",
    name: "房源管理",
    auth: 101,
    element: <Housing />,
  },
  {
    path: "/home/live",
    name: "直播管理",
    auth: 102,
    element: <Live />,
  },
  {
    path: "/home/group",
    name: "团购管理",
    auth: 103,
    element: <Group />,
  },
  {
    path: "/home/audit",
    name: "审核管理",
    auth: 104,
    element: <Audit />,
  },
  {
    path: "/home/order",
    name: "订单管理",
    auth: 105,
    element: <Order />,
  },
  {
    path: "/home/consult",
    name: "咨询管理",
    auth: 106,
    element: <Consult />,
  },
  {
    path: "/home/broker",
    name: "经纪人管理",
    auth: 107,
    element: <Broker />,
  },
];

const changeRoutes = (routes = MenuList) => {
  return [
    {
      path: "/",
      element: <Home />,
    },
    {
      path: "/home",
      element: <Home />,
      children: routes,
    },
    {
      path: "/login",
      element: <Login />,
    },
    {
      path: "/register",
      element: <Register />,
    },
    {
      path: "/livedacte/:id",
      element: <Livedacte />,
    },
    {
      path: "/housingdacte/:id",
      element: <Housingdacte />,
    },
    {
      path: "/housingadd",
      element: <HousingAdd />,
    },
  ];
};

export default changeRoutes;
